package com.yang.project.base.set.map;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTest {
    /**
     * HashMap对null的支持
     * key只会存储一个null值
     * value可以存储多个null
     */
    @Test
    public void test() {
        Map<String, String> map = new HashMap<>();
        map.put("zhangsan", "张三");
        map.put(null, "ksdf");
        map.put(null, "问你");
        Set<String> keySet = map.keySet();
        for (String key : keySet) {
            System.out.println("key: " + key);
            System.out.println("value: " + map.get(key));
        }
    }
}
